import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:fluwx/fluwx.dart' as fluwx;
import 'package:gzmall_app/common/api.dart';
import 'package:gzmall_app/common/toast_util.dart';

class AuthLoginUtil {
  static showAuthSelect(BuildContext context) {
    fluwx.registerWxApi(appId: Api.wxAppId);
    showModalBottomSheet(
      context: context,
      builder: (BuildContext context) {
        return Container(
          padding: const EdgeInsets.only(
              top: 30.0, left: 30.0, right: 30.0, bottom: 120.0),
          color: Colors.white,
          child: Row(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
              InkWell(
                onTap: () {
                  fluwx
                      .sendWeChatAuth(scope: "snsapi_userinfo", state: "gzmall")
                      .then((data) {});
                  Navigator.of(context).pop();
                },
                child: SizedBox(
                  height: 100.0,
                  child: Column(
                    children: <Widget>[
                      Image.asset(
                        'images/wx_session.png',
                        width: 30.0,
                        height: 30.0,
                      ),
                      Padding(
                        padding: const EdgeInsets.only(top: 5.0),
                        child: Text("微信授权登录"),
                      ),
                    ],
                  ),
                ),
              ),
            ],
          ),
        );
      },
    );
  }
}
